﻿using System.Diagnostics;

namespace Framework
{
	public class TimeWatch : Singleton<TimeWatch>
	{
		private Stopwatch stopWatch;

		public void Start()
		{
			if (stopWatch == null)
			{
				stopWatch = new Stopwatch();
				stopWatch.Start();
			}
			else
			{
				stopWatch.Restart();
			}
		}
		public float Watch()
		{
			if (stopWatch == null)
			{
				Logger.LogError("StopWatch = null");
				return 0;
			}
			float ret = stopWatch.Elapsed.Ticks / 10000000.0f;
			return ret;
		}
	}
}